package com.meefo.meeting.interceptor;


import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

@Component
public class FrontInterceptor implements HandlerInterceptor {


    private HttpSession session = null;

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
        session = request.getSession();
        session.setMaxInactiveInterval(24 * 60 * 60);
        /*DingUser dingUser = (DingUser) session.getAttribute("dingUser");
        //缓存中DingUser对象不为空
        if (!StringUtils.isEmpty(dingUser)) {
            setContextDingUser(dingUser);
        }*/
        return true;
    }


    @Override
    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) {
    }

    @Override
    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
    }
}
